package module.scene.view.iso
{
	import com.darwin.darwinBitmapEngine.core.Node;
	import com.darwin.darwinDisplay.DarBitmapMovieNode;
	import com.darwin.darwinDisplay.DarBitmapMovieNodeEvent;
	import com.darwin.darwinDll.Dll;
	import com.darwin.darwinDll.core.DllItem;
	import com.darwin.darwinIsometric.core.IsoObject;
	import com.darwin.darwinUtils.BitmapDataTool;
	
	import flash.display.BitmapData;
	
	import module.scene.consts.SceneConst;
	import module.scene.model.dataObj.IsoDataObj;
	import module.scene.view.iso.base.JusticeIsoObject;
	
	public class FloorIsoObject extends JusticeIsoObject
	{
		public function FloorIsoObject(isoDataObj:IsoDataObj,dataObj:Object = null)
		{
			super(isoDataObj,dataObj);
			hideWithFog = false;
			init();
		}
		
		private var _node:DarBitmapMovieNode;
		private function init():void{
			Dll.getInstance().getMatRes(_serverId,onMatComplete,"MATERIAL_" + _serverId,0,DllItem.TYPE_SWF);
		}
		
		private function onMatComplete(data:Class):void
		{
			if(disposed==true)return;//物件已被销毁,不做后续处理

			_node = new DarBitmapMovieNode(data);
			_node.addEventListener(DarBitmapMovieNodeEvent.DARWIN_DRAW_COMPLETE,onDrawComplete);
			addNode(_node); 
		}
		
		protected function onDrawComplete(event:DarBitmapMovieNodeEvent):void
		{
			_node.removeEventListener(DarBitmapMovieNodeEvent.DARWIN_DRAW_COMPLETE,onDrawComplete);
			_node.x = _node.offsetPoint.x;
			_node.y = _node.offsetPoint.y;
		}
		
		override public function updateFog():void
		{
			return;//地板不响应迷雾
		}
		
		override public function dispose():void
		{
			super.dispose();
			if(_node)
			{
				_node.destroy();
				_node = null;
			}
		}
	}
}